package com.sright.bcard.user.biz.service;

import com.sright.bcard.user.biz.manager.LoginManager;
import com.sright.bcard.common.service.share.dto.user.LoginDTO;
import com.sright.bcard.user.share.request.TokenParam;
import com.sright.bcard.user.share.request.WxappLoginParam;
import com.sright.bcard.user.share.service.LoginService;
import com.sright.common.response.SrightResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class LoginServiceImpl implements LoginService {
    @Autowired
    LoginManager loginManager;

    @Override
    public SrightResponse<LoginDTO> login(String code) {
        return SrightResponse.defaultSuccess(loginManager.login(code));
    }

    @Override
    public SrightResponse<Boolean> setUserInfo(WxappLoginParam param, TokenParam user) throws Exception {
        return SrightResponse.defaultSuccess(loginManager.setUserInfo(param, user));
    }

    @Override
    public SrightResponse showButton(String version) {
        return SrightResponse.defaultSuccess(loginManager.showButton(version));
    }

    @Override
    public SrightResponse testLogin() {
        return SrightResponse.defaultSuccess(loginManager.testLogin());
    }
}
